package com.sds.sweng.swat.miplatform.ui.design.policies;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.requests.CreateRequest;

import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformComponent;
import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformContainer;
import com.sds.sweng.swat.miplatform.ui.design.models.area.AreaTemplate;
import com.sds.sweng.swat.miplatform.ui.design.models.commands.CreateCommand;

public class DesignLayoutEditPolicy extends LayoutEditPolicy {

	protected Command getCreateCommand(CreateRequest request) {
		MiplatformComponent newObject = (MiplatformComponent) request.getNewObject();

		if (newObject instanceof AreaTemplate) {
			CreateCommand command = new CreateCommand(
					(MiplatformContainer) getHost().getModel(),
					newObject);

			return command;
		} else {
			return null;
		}
	}

	@Override
	protected EditPolicy createChildEditPolicy(EditPart child) {
		return null;
	}

	@Override
	protected Command getMoveChildrenCommand(Request request) {
		return null;
	}

}
